import random
import turtle
p=turtle.Turtle()
turtle.bgcolor("red")
turtle.bgpic("./2.gif")
turtle.setup(width=900,height=600,startx=0,starty=0)
turtle.title("星空")
for j in range(200):
    a=(3,5,7,9,11)
    star=random.choice(a)
    x=random.choice(list(range(-400,400,40)))
    y=random.choice(list(range(-290,290,40)))
    p.pensize(1)
    p.penup()
    p.goto(x,y)
    p.pendown()
    yanse=("red","yellow","pink","purple","white","blue","orange")
    yanse=random.choice(yanse)
    p.begin_fill()
    p.color(yanse)
    for i in range(star):
        p.forward(20)
        p.left(180-180/star)

    p.end_fill()
turtle.done()